package com.lanou.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lanou.entity.ClassQaAnswer;
import com.lanou.mapper.ClassQaAnswerMapper;
import com.lanou.service.ClassQaAnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ClassQaAnswerServiceImpl
 * @Description TODO
 * @Author cuiruitong
 * @Date 2025年08月14日 21:07
 * @Version 1.0
 */
@Service
public class ClassQaAnswerServiceImpl implements ClassQaAnswerService {
    @Autowired
    private ClassQaAnswerMapper classQaAnswerMapper;
    @Override
    public PageInfo<ClassQaAnswer> getClassQaAnswerList(int questionId, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ClassQaAnswer> classQaAnswerList = classQaAnswerMapper.getClassQaAnswerList(questionId);
        PageInfo<ClassQaAnswer> pageInfo = new PageInfo<>(classQaAnswerList);
        return pageInfo;
    }

    @Override
    public int addClassQaAnswer(ClassQaAnswer classQaAnswer) {

        return classQaAnswerMapper.addClassQaAnswer(classQaAnswer);
    }
}
